﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoreLib.DAL
{
    public class UtilityClass
    {
        public static Address AddressSelectByPersonIDResultToAddress(AddressSelectByPersonIDResult addressSelectByPersonIDResult)
        {
            return (null != addressSelectByPersonIDResult)?
                new Address()
            {
                AddressID = addressSelectByPersonIDResult.AddressID,
                AddressLine1 = addressSelectByPersonIDResult.AddressLine1,
                AddressLine2 = addressSelectByPersonIDResult.AddressLine2,
                AddressLine3 = addressSelectByPersonIDResult.AddressLine3,
                AddressLine4 = addressSelectByPersonIDResult.AddressLine4,
                PostalCode = addressSelectByPersonIDResult.PostalCode,
                Country = addressSelectByPersonIDResult.Country,
                Email = addressSelectByPersonIDResult.Email,
                PhoneNumber = addressSelectByPersonIDResult.PhoneNumber,
                CreateDate = addressSelectByPersonIDResult.CreateDate,
                ModifyDate = addressSelectByPersonIDResult.ModifyDate
            } :
            new Address();
        }

        public static Address AddressSelectByAddressIDResultToAddress(AddressSelectByAddressIDResult addressSelectByAddressIDResult)
        {
            return (null != addressSelectByAddressIDResult) ?
                new Address()
            {
                AddressID = addressSelectByAddressIDResult.AddressID,
                AddressLine1 = addressSelectByAddressIDResult.AddressLine1,
                AddressLine2 = addressSelectByAddressIDResult.AddressLine2,
                AddressLine3 = addressSelectByAddressIDResult.AddressLine3,
                AddressLine4 = addressSelectByAddressIDResult.AddressLine4,
                PostalCode = addressSelectByAddressIDResult.PostalCode,
                Country = addressSelectByAddressIDResult.Country,
                Email = addressSelectByAddressIDResult.Email,
                PhoneNumber = addressSelectByAddressIDResult.PhoneNumber,
                CreateDate = addressSelectByAddressIDResult.CreateDate,
                ModifyDate = addressSelectByAddressIDResult.ModifyDate
            } :
            new Address();
        }

        public static Transaction TransactionsSelectByTransactionIDResultToTransaction(TransactionsSelectByTransactionIDResult transactionsSelectByTransactionIDResult)
        {
            return (null != transactionsSelectByTransactionIDResult) ?
                new Transaction()
                {
                    AddressID = transactionsSelectByTransactionIDResult.AddressID,
                    PersonID = transactionsSelectByTransactionIDResult.PersonID,
                    TransactionID = transactionsSelectByTransactionIDResult.TransactionID,
                    TransactionAmount = transactionsSelectByTransactionIDResult.TransactionAmount,
                    TransactionDate = transactionsSelectByTransactionIDResult.TransactionDate,
                    TransactionModeID = transactionsSelectByTransactionIDResult.TransactionModeID,
                    TransactionModeBank = transactionsSelectByTransactionIDResult.TransactionModeBank,
                    TransactionModeDate = transactionsSelectByTransactionIDResult.TransactionModeDate,
                    TransactionModeNumber = transactionsSelectByTransactionIDResult.TransactionModeNumber,
                    CreateDate = transactionsSelectByTransactionIDResult.CreateDate,
                    ModifyDate = transactionsSelectByTransactionIDResult.ModifyDate
                }:
                new Transaction();
        }

        public static TransactionReceiptDetail TransactionReceiptDetailSelectByTransactionReceiptDetailIDResultToTransactionReceiptDetail(TransactionReceiptDetailSelectByTransactionReceiptDetailIDResult transactionReceiptDetailSelectByTransactionReceiptDetailIDResult)
        {
            return (null != transactionReceiptDetailSelectByTransactionReceiptDetailIDResult) ?
                new TransactionReceiptDetail()
                {
                    TransactionReceiptDetailID = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.TransactionReceiptDetailID,
                    TransactionID = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.TransactionID,
                    TransactionReceiptNumber = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.TransactionReceiptNumber,
                    TransactionReceiptDate = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.TransactionReceiptDate,
                    PostalModeID = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.PostalModeID,
                    DonationPlaceID = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.DonationPlaceID,
                    DonationAccountID = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.DonationAccountID,
                    DespatchDate = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.DespatchDate,
                    CreateDate = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.CreateDate,
                    ModifyDate = transactionReceiptDetailSelectByTransactionReceiptDetailIDResult.ModifyDate,
                } :
                new TransactionReceiptDetail();
        }
    }
}
